home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 4 #11
/
Commodore_Disk_User_Vol.4_11_1991_-.d64
/
clubhouse d-a
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
3KB
|
99 lines
1000 *=$c000
1010 !
1020 ! this code reads in track 18, sector 1
1030 ! and stores the 256 bytes at $cf00 onwards
1040 !
1050 ! written by jason finch 1991
1060 !
1070 !
1080 (NULL)lfs = $ffba ;_ set file details
1090 (NULL)nam = $ffbd ;_ set file name
1100 open = $ffc0 ;_ open logical file
1110 close = $ffc3 ;_ close logical file
1120 chkin = $ffc6 ;_ open channel for input
1130 chkout = $ffc9 ;_ open channel for output
1140 clrchn = $ffcc ;_ close input and output channels
1150 chrin = $ffcf ;_ input character from channel
1160 writecmd = $ab1e ;_ set-up command ready to send
1170 send = $abb5 ;_ send command (equiv. of print# statement)
1180 !
1190 !
1200 lda #$02;_ 2 char file name
1210 ldx #<i0;_ lo/hi for file name
1220 ldy #>i0
1230 jsr (NULL)nam;_ set the file name
1240 ;
1250 lda #$0f;_ open 15,
1260 ldx #$08;_ 8,
1270 ldy #$0f;_ 15
1280 jsr (NULL)lfs;_ set these parameters
1290 jsr open;_ open 15,8,15,"i0"
1300 ;
1310 bcs error;_ disk error
1320 ;
1330 lda #$01;_ 1 char file name
1340 ldx #<hash;_ lo/hi for file name
1350 ldy #>hash;
1360 jsr (NULL)nam;_ set the file name
1370 ;
1380 lda #$02;_ open 2,
1390 ldx #$08;_ 8,
1400 ldy #$02;_ 2
1410 jsr (NULL)lfs;_ set these parameters
1420 jsr open;_ open 2,8,2,"#"
1430 ;
1440 ldx #$0f
1450 jsr chkout;_ logical file 15 is an output channel
1460 ;
1470 lda #<command;_ lo/hi for start of command
1480 ldy #>command;
1490 jsr writecmd;_ get it ready to send
1500 jsr send;_ do equiv. of print# command in basic
1510 ;
1520 ldx #$02
1530 jsr chkin;_ prepare for input from logical file 2 (the buffer)
1540 ;
1550 ldy #$00;_ reset offset
1560 lp1 jsr chrin;_ get a character from the input channel (buffer)
1570 sta $cf00,y;_ store the character at $cf00-
1580 iny;_ increase offset
1590 bne lp1;_ if all 256 not done, go back for more
1600 ;
1610 lda #$02
1620 jsr close;_ close logical file 2
1630 ;
1640 lda #$0f
1650 jsr close;_ and close 15
1660 ;
1670 jsr clrchn;_ reset the i/o channels
1680 ;
1690 rts;_ back to basic with the right information stored, hopefully!
1700 !
1710 !
1720 !
1730 error ;
1740 ;
1750 lda #$0f
1760 jsr close;_ close 15
1770 ;
1780 jsr clrchn;_ reset i/o channels
1790 ;
1800 rts;_ return to basic - device not present
1810 !
1820 !
1830 ! the following are the different
1840 ! filenames and the command
1850 !
1860 ! copy exactly or this method
1870 ! will not work
1880 !
1890 !
1900 i0 byt "i0";_ this is sent to initialise the drive
1910 ;
1920 hash byt "#";_ the file name for the buffer
1930 ;
1940 command byt "u1:2 0 18 01",0;_ note the ',0' at the end - it is vital
1950 ;
1960 ! the '0' is a zero byte - not the ascii value for '0'
1970 ! it tells the computer where the end of the command lies